package com.zzyl.nursing.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzyl.nursing.domain.member.FamilyMemberElder;
import com.zzyl.nursing.dto.member.QueryDeviceDataListByDay;
import com.zzyl.nursing.vo.member.MemberInfo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 *TODO
 *@Author zhu
 *@Date 2025/10/29 16:34
 */
@Mapper
public interface MemberUserMapper extends BaseMapper<FamilyMemberElder> {


    /**
     * 分页查询
     * @param
     * @return 分页结果
     */
    List<MemberInfo> listpage(Long userId);


    /**
     * @param
     * @return
     */
    @MapKey("time")
    List<Map<String, Object>> queryDeviceDataListByDay(
            @Param("iotId") String iotId,
            @Param("functionId") String functionId,
            @Param("startTime") LocalDateTime startTime,
            @Param("endTime") LocalDateTime endTime
    );
    @MapKey("date")
    List<Map<String, Object>> queryDeviceDataListByWeek(@Param("iotId") String iotId,
                                                        @Param("functionId") String functionId,
                                                        @Param("startTime") LocalDateTime startTime,
                                                        @Param("endTime") LocalDateTime endTime);

    /**
     * 解绑老人
     * @param id
     */
    @Delete("delete from family_member_elder where id=#{id}")
    void deletebyid(Integer id);
}